<?php

namespace App\NaiveUI;

use LowCode\Naive;
use LowCode\UI;

class Button
{
    public static function example(): Naive\Flex
    {
//        $types = ["default","tertiary","primary","info","success","warning","error"];
//        $buttons = [];
//        foreach ($types as $type){
//            $buttons[] =
//        }
        return Naive::flex([
            Naive::card("主要按钮",self::basic())->bordered(jsExp("true"))->style("width","45%"),
            Naive::card("透明背景按钮",self::ghost())->bordered(false)->style("width","45%"),
            Naive::card("虚线按钮",self::dashed())->bordered(false)->style("width","45%"),
            Naive::card("次要按钮",self::secondary())->bordered(false)->style("width","45%"),
            Naive::card("次次要按钮",self::tertiary())->bordered(false)->style("width","45%"),
            Naive::card("尺寸大小",self::size())->bordered(false)->style("width","45%"),
            Naive::card("圆角按钮",self::round())->bordered(false)->style("width","45%"),
            Naive::card("图标按钮",self::icon())->bordered(false)->style("width","45%"),
            Naive::card("按钮组",self::group())->bordered(false)->style("width","45%"),
        ])->wrap();
    }
    public static function basic(): Naive\Flex
    {
        return Naive::flex([
            Naive::button("default"),
            Naive::button("tertiary")->type("tertiary"),
            Naive::button("primary")->primary(),
            Naive::button("info")->info(),
            Naive::button("success")->success(),
            Naive::button("warning")->warning(),
            Naive::button("error")->error(),
            Naive::button("文本按钮")->text(),
        ]);
    }

    public static function ghost(): Naive\Flex
    {
        return Naive::flex([
            Naive::button("default")->ghost(),
            Naive::button("primary")->ghost()->primary(),
            Naive::button("info")->ghost()->info(),
            Naive::button("success")->ghost()->success(),
            Naive::button("warning")->ghost()->warning(),
            Naive::button("error")->ghost()->error(),
        ]);
    }

    public static function dashed(): Naive\Flex
    {
        return Naive::flex([
            Naive::button("default")->dashed(),
            Naive::button("primary")->dashed()->primary(),
            Naive::button("info")->dashed()->info(),
            Naive::button("success")->dashed()->success(),
            Naive::button("warning")->dashed()->warning(),
            Naive::button("error")->dashed()->error(),
        ]);
    }

    public static function secondary(): Naive\Flex
    {
        return Naive::flex([
            Naive::button("default")->secondary(),
            Naive::button("primary")->secondary()->primary(),
            Naive::button("info")->secondary()->info(),
            Naive::button("success")->secondary()->success(),
            Naive::button("warning")->secondary()->warning(),
            Naive::button("error")->secondary()->error(),
        ]);
    }

    public static function tertiary(): Naive\Flex
    {
        return Naive::flex([
            Naive::button("default")->tertiary(),
            Naive::button("primary")->tertiary()->primary(),
            Naive::button("info")->tertiary()->info(),
            Naive::button("success")->tertiary()->success(),
            Naive::button("warning")->tertiary()->warning(),
            Naive::button("error")->tertiary()->error(),
        ]);
    }

    public static function size(): Naive\Flex
    {
        return Naive::flex([
            Naive::button("大尺寸")->large(),
            Naive::button("默认尺寸")->primary()->medium(),
            Naive::button("小尺寸")->success()->small(),
            Naive::button("小小尺寸")->warning()->tiny(),
        ]);
    }

    public static function round(): Naive\Flex
    {
        return Naive::flex([
            Naive::button("default")->round(),
            Naive::button("primary")->round()->primary(),
            Naive::button("info")->round()->info(),
            Naive::button("success")->round()->success(),
            Naive::button("warning")->round()->warning(),
            Naive::button("error")->round()->error(),
        ]);
    }

    public static function icon(): Naive\Flex
    {
        return Naive::flex([
            Naive::button()->slotIcon(UI::svgIcon("mdi:home"))->round(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:user"))->circle()->primary(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:bank"))->ghost()->info(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:add"))->dashed()->success(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:delete"))->secondary()->warning(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:edit"))->tertiary()->error(),
        ]);
    }

    public static function group(): Naive
    {
        return Naive::buttonGroup([
            Naive::button()->slotIcon(UI::svgIcon("mdi:home"))->round(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:user"))->circle()->primary(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:bank"))->ghost()->info(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:add"))->dashed()->success(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:delete"))->secondary()->warning(),
            Naive::button()->slotIcon(UI::svgIcon("mdi:edit"))->tertiary()->error(),
        ]);
    }
}
